package com.njit.mailm.core.service.impl;

import com.njit.mailm.core.bean.Email;
import com.njit.mailm.core.bean.MessageWrap;
import com.njit.mailm.core.bean.Page;
import com.njit.mailm.core.dao.ManagerDao;
import com.njit.mailm.core.service.ManagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by Administrator on 2016/4/9.
 */
@Transactional
@Service
public class ManagerServiceImpl  implements ManagerService {

    @Autowired
    private ManagerDao managerDao;
    public void delete(String[] ids) {
        managerDao.deleteMessageById(ids);
    }

    public void setRead(String[] ids,boolean isread) {

        managerDao.setReadById(ids,isread);
    }

    public List<MessageWrap> listMessageFromTrash(String id) {

        return managerDao.selectMessageFromTrash(id);
    }

    public int getTotalMessageNumber(String emailAccount) {

        return managerDao.getTotalMessageNumber(emailAccount);
    }

    public int getDeleteNumber(Email email) {
        return managerDao.getDeleteNumber(email);
    }

    public List<MessageWrap> pageListStar(Page p, Email email) {
        return managerDao.pageListStar(p,email);
    }

    public int getStarTotal(Email email) {
        return managerDao.getStarTotal(email);
    }

    public void setStar(boolean setStar, String id) {
        managerDao.setStar(setStar,id);
    }

    public List<MessageWrap> pageListTrash(Page p, Email email) {
        return managerDao.pageListTrash(p,email);
    }

    public int getTrashTotal(Email email) {
        return managerDao.getTrashTotal(email);
    }
}
